﻿   $().ready(function () {
        UserLogin();
        $("#MenuUserPanel").hide();
        $("#CSP_MyTongShuYa").bind("mouseenter", function () {
                       $("#CSP_MyTongShuYa").attr("class","menu hover");
                    $("#MenuUserPanel").show();
                });
        $("#CSP_MyTongShuYa").bind("mouseleave", function () {
                    $("#CSP_MyTongShuYa").attr("class","menu ");
                    $("#MenuUserPanel").hide();
                });
        $("#MenuUserPanel").bind("mouseenter", function () {
                    $("#CSP_MyTongShuYa").attr("class","menu hover");
                    $("#MenuUserPanel").show();
                });
        $("#MenuUserPanel").bind("mouseleave", function () {
                    $("#CSP_MyTongShuYa").attr("class","menu ");
                    $("#MenuUserPanel").hide();
                });

    });

    function OtherLogin(o){
	alert(o.screen_name);
	} 

	function OtherLoginOut(){
	alert('logout');	
	}

    //用户登陆验证
    function UserLogin() {
        $.ajax({
            type: "get",
            url: "/index.aspx?userlogin=1",
            dataType: "json",
            cache: false,
            async: true,
            success: function (data, textStatus, jqXHR) {
                //{Status:0,UserName}
                //登陆请求成功
                if (data.Status == 1) {
                    $("#noLogin").hide();
                    $("#LoginUser").text(data.UserName);
                    $("#logined").show();
                }
            },
            error:function(result){
                result;
            }
        });
    }

    //用户退出
    function LoginOut() {

        $.ajax({
            type: "get",
            url: "/index.aspx?loginout=1",
            dataType: "json",
            cache: false,
            async: true,
            success: function (data, textStatus, jqXHR) {
                //{Status:0,UserName}
                //退出登陆请求成功
                if (data.Status == 1) {
                    $("#logined").hide();
                    $("#noLogin").show();                    
                }
            }
        });
    }
    function ShowMenuUserPanel(){
        $("#MenuUserPanel").show();
    }

    function HideMenuUserPanel(){
        
    }